package wec_wallet.ebo.com.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import bassproject.ebo.com.ebobass.activity.MyBaseActivity;
import bassproject.ebo.com.ebobass.refreshview.XRefreshView;
import wec_wallet.ebo.com.R;

public class RefreshActivity extends MyBaseActivity {
    private XRefreshView refreshView;
    public static long lastRefreshTime;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_refresh);
        initViews();
    }

    @Override
    public void initViews() {
        TextView tv = (TextView) findViewById(R.id.textView);
        tv.setText("下拉刷新 上拉加载");

        refreshView = (XRefreshView) findViewById(R.id.custom_view);
        // 设置是否可以下拉刷新
        refreshView.setPullRefreshEnable(true);
        // 设置是否可以上拉加载
        refreshView.setPullLoadEnable(true);
        // 设置上次刷新的时间
        refreshView.restoreLastRefreshTime(lastRefreshTime);
        //当下拉刷新被禁用时，调用这个方法并传入false可以不让头部被下拉
        refreshView.setMoveHeadWhenDisablePullRefresh(true);
        // 设置时候可以自动刷新
        refreshView.setAutoRefresh(false);
        refreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
            @Override
            public void onRefresh(boolean isPullDown) {
                refreshView.stopRefresh();
                show_Toast("刷新完成");
            }
            @Override
            public void onLoadMore(boolean isSilence) {
                refreshView.stopLoadMore();
                show_Toast("加载完成");
            }
        });
    }

    @Override
    public void onClick(View v) {

    }


}
